package com.ruoyi.platform.system.role.controller;

import com.ruoyi.base.annotaion.TokenIgnore;
import com.ruoyi.base.controller.BaseController;
import com.ruoyi.base.pojo.HttpResult;
import com.ruoyi.platform.system.role.enums.RoleEnum;
import com.ruoyi.platform.system.role.pojo.RoleDTO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * 角色
 *
 * @author lcf
 */
@Api(tags = {"角色"})
@RestController
@RequestMapping("/role")
public class RoleController extends BaseController {
    /**
     * 获取角色列表
     */
    @TokenIgnore
    @ApiOperation("获取角色列表")
    @GetMapping("/list")
    public HttpResult<List<RoleDTO>> getRoleList() {
        List<RoleDTO> roleList = Arrays.stream(RoleEnum.values()).map(RoleDTO::new).collect(Collectors.toList());

        return data(roleList);
    }
}
